home *** CD-ROM | disk | FTP | other *** search
/ FishMarket 1.0 / FishMarket v1.0.iso / fishies / 351-375 / disk_352 / treewalk / rexx / twpath.ftw < prev   
Text File  |  1992-05-06  |  1KB  |  37 lines

  1. /*
  2.  * twpath - returns the absolute path to the root directory of the
  3.  * current treewalk, if the clips are set right.
  4.  *
  5.  *    Copyright (C) 1989  Mike Meyer
  6.  *
  7.  *    This program is free software; you can redistribute it and/or modify
  8.  *    it under the terms of the GNU General Public License as published by
  9.  *    the Free Software Foundation; either version 1, or any later version.
  10.  *
  11.  *    This program is distributed in the hope that it will be useful,
  12.  *    but WITHOUT ANY WARRANTY; without even the implied warranty of
  13.  *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14.  *    GNU General Public License for more details.
  15.  *
  16.  *    You should have received a copy of the GNU General Public License
  17.  *    along with this program; if not, write to the Free Software
  18.  *    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  19.  */
  20.  
  21. /* Use the value we already calculated, if we can */
  22. dir = getclip('tw.fullpath')
  23. if dir ~= "" then return dir
  24.  
  25. /* Not there, got to work it out */
  26. dir = getclip('tw.dirname')
  27. if dir = "" then return ""        /* If no directory, punt */
  28.  
  29. dir = pragma('Directory', dir)        /* There and */
  30. root = pragma('Directory', dir)        /* back again. */
  31.  
  32. /* Add the trailing slash if needed */
  33. if right(root, 1) ~= ':' then root = root'/'
  34.  
  35. call setclip 'tw.fullpath', root
  36. return root
  37.